import vueRouter from "@/router";
import { getAction } from "@/command/netTool";
const userInfo = localStorage.getItem("userInfo") as string;
const userInfoJSON = JSON.parse(userInfo) as any;
interface ToChatDetailOptions {
  name?: string;
  to?: string;
}
/**
 * @description 跳转到聊天详情
 */
export const toChatDetail = function (options: ToChatDetailOptions = {}) {
  const { to = "", name = "聊天室" } = options;
  getAction("/api/im/msg/getH5ImUser", { toPhone: to });
  console.log(
    "7777777",
    `/serviceTim?userId=${userInfoJSON.phone}&name=${name}&to=${to}`
  );
  vueRouter.push(
    `/serviceTim?userId=${userInfoJSON.phone}&name=${name}&to=${to}`
  );
};

export default {
  toChatDetail,
};
